//
//  SetUpInforViewController.m
//  GLGW_Shoping
//
//  Created by yang on 2018/11/28.
//  Copyright © 2018年 yang. All rights reserved.
//

#import "SetUpInforViewController.h"
#import "SetUpInforViewModel.h"
#import "AccountAndSecurityViewController.h"
#import "MyInformationViewController.h"
#import "NotifacationViewController.h"
#import "BindingAccountViewController.h"
#import "AdoutUsViewController.h"
#import "AuthenticationEnterpriseViewController.h"
#import "FreeCerMagmentViewController.h"

@interface SetUpInforViewController ()<SetUpListDelegate>
@property (nonatomic,strong) SetUpInforViewModel * setViewModel;
@end

@implementation SetUpInforViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"设置";
    [self.navigationController.navigationBar setShadowImage:[YLJ_ImageTool imageWithLineColor:[UIColor colorWithHexString:@"#F2F2F2"]]];//导航条下面的线
    self.setViewModel = [[SetUpInforViewModel alloc] initWithViewToViewModel:self.tableView theSuperView:self.view];
    self.setViewModel.delegate = self;
}

#pragma mark -- SetUpListDelegate
-(void)setUpDidSelectRowAtIndexPath:(NSIndexPath *)set_index{
    switch (set_index.section) {
        case 0:{
            if (set_index.row == 0) {
                AccountAndSecurityViewController * accountVC = [AccountAndSecurityViewController new];
                [self.navigationController pushViewController:accountVC animated:YES];
            }else{
                MyInformationViewController * informationVC = [MyInformationViewController new];
                [self.navigationController pushViewController:informationVC animated:YES];
            }
        }
            break;
        case 1:{
            if (set_index.row == 0) {
                NotifacationViewController * notifaVC = [NotifacationViewController new];
                [self.navigationController pushViewController:notifaVC animated:YES];
            }else{
                BindingAccountViewController * bindingVC = [BindingAccountViewController new];
                [self.navigationController pushViewController:bindingVC animated:YES];
            }
        }
            break;
        case 2:{
            if (set_index.row == 0) {
                if (self.accountType == AccountType_FreeManagers) {
                    FreeCerMagmentViewController * freeCerVc = [FreeCerMagmentViewController new];
                    [self.navigationController pushViewController:freeCerVc animated:YES];
                }else{
                    AuthenticationEnterpriseViewController * authenticationVc = [AuthenticationEnterpriseViewController new];
                    [self.navigationController pushViewController:authenticationVc animated:YES];
                }
            }else{
                AdoutUsViewController * adoutVC = [AdoutUsViewController new];
                [self.navigationController pushViewController:adoutVC animated:YES];
            }
        }
            break;
            
        default:
            break;
    }
}

-(void)exitAccount{
    NSString *appDomain = [[NSBundle mainBundle] bundleIdentifier];
    [[NSUserDefaults standardUserDefaults] removePersistentDomainForName:appDomain];
    [self.navigationController popViewControllerAnimated:YES];
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
